/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Dao;

import Pojo.HoaDon;
import Util.MySqlDataAccessHelper;

/**
 *
 * @author USER
 */
public class HoaDonDAO {

    public static int themHoaDon(HoaDon hd) {
        int kq;
        MySqlDataAccessHelper helper = new MySqlDataAccessHelper();
        helper.open();
        String sql = String.format("INSERT INTO `hoa_don` (`ngay_lap_hoa_don`,`tong_tien`,`ten_nhan_vien`) VALUES ('%s',%f,'%s')",
                 hd.getNgayLapHoaDon(), hd.getTongTien(), hd.getTenNhanVien());
        kq = helper.executeNonQueryReturnGeneratedKey(sql);
        helper.close();
        return kq;
    }
}
